package den.Study_2;

public class LinkNode {
	private Node head=null;
	/**public LinkNode(Node next){
		this.next=next;
	}*/
	public Node next(){
		return head;
	}
//	public void setNull(Node node){
//		node.next=null;
//	}
	public boolean hasnode(Node node){
		if(node.next!=null)
			return true;
		else
			return false;
	}
	public void addNodeAtLast(int value){
		Node node = new Node(value);
		if(head==null)
		{
			head=node;
		}
		else
		{
			Node temp=head;
			while(temp.next!=null)
			{
				temp=temp.next;
			}
			temp.next=node;
		}
	}
	public Node getNode(int index ){
		Node node=null;
		for(int i=0;i<index;i++){
			node=next();
		}
		if(hasnode(node)){
			return node;
		}
		
		return null;
		
	}
	public void delete(){
		Node node=null;
		node=node.next;
		node=null;
	}
	

}
